package com.xd.clap.controller;

import com.xd.clap.entity.Classify;
import com.xd.clap.entity.response.Result;
import com.xd.clap.services.ClassifyService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/classify")
public class ClassifyController {

    @Resource
    private ClassifyService cs;

    /**
     * 查询所有的类别
     */
    @GetMapping("/getClassifyList")
    public Result getClassifyList(){
        return cs.getClassifyList();
    }

    /**
     * 修改分类
     */
    @PutMapping("/updateClassify")
    public Result updateClassify(@RequestBody Classify classify){
        return cs.updateClassify(classify);
    }

    /**
     * 删除分类
     */
    @DeleteMapping("/deleteClassify")
    public Result deleteClassify(Classify classify){
        return cs.deleteClassify(classify.getId());
    }
}
